﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.Win32;

namespace Wicresoft.Shell.Core
{
    public sealed class AppEnv
    {
        private const string _root = "UmcVisualDesigner";

        public static string AppRoot
        {
            get
            {
                return String.Format(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppEnv\9.0\Apps\{0}", _root);
            }
        }

        /// <summary>
        /// $(MyDocuments)\Documents\Ideal Mobile Platform\Settings\Configurations
        /// </summary>
        public static string UserSettingPath
        {
            get
            {
                var s = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

                s = Path.Combine(s, DefaultUserFilesFolderRoot);
                s = Path.Combine(s, "Settings");
                s = Path.Combine(s, UserFilesSubFolderName);

                return s;
            }
        }

        public static string DefaultUserFilesFolderRoot
        {
            get
            {
                return Registry.GetValue(AppRoot, "DefaultUserFilesFolderRoot", String.Empty).ToString();
            }
        }

        public static string UserFilesSubFolderName
        {
            get
            {
                return Registry.GetValue(AppRoot, "UserFilesSubFolderName", String.Empty).ToString();
            }
        }
    }
}
